package com.g13.virtualpethospital.util;

import com.g13.virtualpethospital.common.EntityCommon;
import com.g13.virtualpethospital.config.AppConfig;

/**
 * @Title: FileUtil
 * @Author yyj1205
 * @Package com.g13.virtualpethospital.util
 * @Date 29/3/2024 13:37
 * @description: Utility used for manage file
 */
public class FileUtil {
    public static String convertMultiMediaType(EntityCommon.MultiMediaType type){
        String filetype;
        switch (type){
            case PIC:
                filetype = "picture";
                break;
            case VIDEO:
                filetype = "video";
                break;
            default:
                filetype = "others";
                break;
        }
        return filetype;
    }
    public static String convertRoleType(EntityCommon.RoleType type){
        switch (type){
            case USER:
                return "user";
            case ADMIN:
                return "admin";
            case SUPERADMIN:
                return "superadmin";
            default:
                return "others";
        }
    }
    public static String getFilePath(EntityCommon.MultiMediaType type, String fileName){
        AppConfig appConfig = new AppConfig();
        return appConfig.getFileExternHost() + '\\' + type + '\\' + fileName;
    }
}
